﻿using System;
using System.Collections.Generic;
using System.Text;
using Watchdog.Dal;
using Watchdog.Bll;
using Watchdog.Bll.Base;

namespace Watchdog.Bll.Factory {

    public partial class TargetTypeFactory {
		public static void AddDefinition (TargetType targettype, Definition definition ) {
			DataClient.Current.TargetTypeAddDefinition (targettype.IntData, definition.IntData );
		}
        public static void Delete ( TargetTypeBase targettype ) {
            DataClient.Current.TargetTypeDelete ( targettype.IntData );
        }

        public static List<TargetType> GetByDefinition ( int definition ) {
		    List<TargetType> outlist = new List<TargetType> ();
            Watchdog.Facade.TargetType[] list = Dal.DataClient.Current.TargetTypeGetByDefinition ( definition );
            foreach (Watchdog.Facade.TargetType item in list)
                outlist.Add (new TargetType (item));
            return outlist;
            // return DataClient.Current.TargetTypeGetByDefinition ( definition );
        }
        public static TargetType GetById ( int id ) {
            return new TargetType (DataClient.Current.TargetTypeGetById (id));
        }
				
        public static void Insert ( TargetTypeBase targettype ) {
            targettype.IntData = DataClient.Current.TargetTypeInsert ( targettype.IntData );
        }

        public static void RemoveDefinition ( TargetType targettype, Definition definition ) {
			DataClient.Current.TargetTypeRemoveDefinition (targettype.IntData, definition.IntData );
		}
        public static void Update ( TargetTypeBase targettype ) {
            DataClient.Current.TargetTypeUpdate ( targettype.IntData );
        }
		
	}
}
